<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
	  xmlns:a4j="http://richfaces.org/a4j">

	<body>
	
		<ui:composition template="../templates/template.xhtml">
		
			<ui:define name="title">#{bundle.carro_titulo_consultar}</ui:define>

			<ui:define name="content">
				
				<rich:panel>
					<f:facet name="header">#{bundle.carro_titulo_consultar}</f:facet>
					<a4j:form>
						<h:panelGrid columns="2">
						<h:commandButton action="#{carroBackBean.obterListaCarro}" value="#{bundle.carro_btn_consultar}" />
						
						<a4j:commandButton value="#{bundle.carro_btn_novo}" actionListener="#{carroBackBean.listenerIrInserirCarro}" id="btnNovo" reRender="formCarroManter, id_carro">
							<rich:componentControl for="manterCarro" attachTo="btnNovo" operation="show" event="onclick" />
						</a4j:commandButton>
						</h:panelGrid>
						
						<div class="linha"/>
						
						<rich:dataTable value="#{carroBackBean.carroFormBean.listaCarro}" var="carro" id="gridCarro" rows="10" align="center" width="100%">
							<rich:column filterBy="#{carro.placa}">
								<f:facet name="header">
									<h:outputText value="#{bundle.carro_placa}" />
								</f:facet>
								<h:outputText value="#{carro.placa}" />
							</rich:column>
							<rich:column filterBy="#{carro.modeloVO.descricao}">
								<f:facet name="header">
									<h:outputText value="#{bundle.carro_modelo}" />
								</f:facet>
								<h:outputText value="#{carro.modeloVO.descricao}"/>
							</rich:column>
							<rich:column filterBy="#{carro.modeloVO.marcaVO.descricao}" >
								<f:facet name="header">
									<h:outputText value="#{bundle.carro_modelo_marca}"/>
								</f:facet>
								<h:outputText value="#{carro.modeloVO.marcaVO.descricao}" />
							</rich:column>
							<rich:column filterBy="#{carro.dataCriacao}">
								<f:facet name="header">
									<h:outputText value="#{bundle.carro_data_criacao}"/>
								</f:facet>
								<h:outputText value="#{carro.dataCriacao}">
									<f:convertDateTime pattern="dd/MM/yyyy, HH:mm" timeZone="America/Sao_Paulo" />
								</h:outputText>
							</rich:column>
							<rich:column filterBy="#{carro.dataAlteracao}">
								<f:facet name="header">
									<h:outputText value="#{bundle.carro_data_alteracao}"/>
								</f:facet>
								<h:outputText value="#{carro.dataAlteracao}">
									<f:convertDateTime pattern="dd/MM/yyyy, HH:mm" timeZone="America/Sao_Paulo" />
								</h:outputText>
							</rich:column>
							<rich:column>
								<a4j:commandButton id="btnEditar" actionListener="#{carroBackBean.listenerIrEditarCarro}" value="#{bundle.carro_btn_editar}" reRender="formCarroManter, id_carro">
									<f:param id="codigoCarroEditar" name="codigoCarroEditar" value="#{carro.codigo}" />
									<rich:componentControl for="manterCarro" attachTo="btnEditar" operation="show" event="onclick" />
								</a4j:commandButton>
							</rich:column>
							<rich:column>
								<a4j:commandButton id="btnExcluir" actionListener="#{carroBackBean.listenerIrExcluirCarro}" value="#{bundle.carro_btn_excluir}" reRender="formCarroManter, id_carro">
									<f:param id="codigoCarroExcluir" name="codigoCarroExcluir" value="#{carro.codigo}" />
									<rich:componentControl for="manterCarro" attachTo="btnExcluir" operation="show" event="onclick" />
								</a4j:commandButton>
							</rich:column>
						</rich:dataTable>
						
						<rich:datascroller for="gridCarro" maxPages="10"/>
						
						<div class="linha"/>
					
					</a4j:form>
				</rich:panel>
				
				<ui:include src="/pages/carro/manterCarro.xhtml" />
				
			</ui:define>
			
		</ui:composition>
		
	</body>

</html>